<?php
// Path: system/functions.php

// Class autoload
function __autoload($name) {
  global $framework;
  $pad = "class_";
  $name = substr($name, strlen($pad));
  require_once($framework['variables']['paths']['system'] = "system/" . 'classes/' . $name . '.class.php');
}

// Custom isset
function __isset($input) {
  if (isset($input) && $input !== "" && $input !== NULL) {
    return true;
  }
  else {
    return false;
  }
}

// Registry add
function registry_add($key, $value) {
  global $framework;
  if ($framework['classes']['registry']->add($key, $value) == true) {
    return true;
  }
  else {
    return false;
  }
}

// Registry delete
function registry_delete($key) {
  global $framework;
  if ($framework['classes']['registry']->delete($key) == true) {
    return true;
  }
  else {
    return false;
  }
}

// Registry modify
function registry_modify($key, $value) {
  global $framework;
  if ($framework['classes']['registry']->modify($key, $value) == true) {
    return true;
  }
  else {
    return false;
  }
}

// Registry get
function registry_get($key = "") {
  global $framework;
  if (__isset($key)) {
    return $framework['classes']['registry']->get($key);
  }
  else {
    return $framework['classes']['registry']->get();
  }
}

// Load
function load($type, $name) {
  global $framework;
  return $framework['classes']['framework']->load($type, $name);
}

?>
